package com.vitech.javacertification.collections;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.TreeSet;
import java.util.Vector;


abstract class ColectionsPlayground {



	static public void main(String[] args) {

		linkList();
	}

	
	static void linkedHashMap(){
		
		Map<String, String > fruit = new LinkedHashMap<String, String> (); 
		fruit.put("Apple", "red"); 
		fruit.put("Mango", "yellow"); 
		fruit.put("Guava", "green"); 
		fruit.put("Cherry", "red"); 
		fruit.put ("Mango", "red");
		fruit.put("Apple", "red"); 
		fruit.put("Apple", "red"); 
		fruit.put("Apple", "red"); 

		for (String key : fruit.keySet()) 

		{ 

		System.out.println(key + ": " + fruit.get(key)); 

		} 

		
	}
	
	static void testTreeSet(){
		
		TreeSet<Integer> tree = new TreeSet<Integer>();
		
		tree.add(100);
		tree.add(200);
		tree.add(300);
		tree.add(400);
		
		
		Object floor = tree.floor(250);
		
		Object ceiling = tree.ceiling(350);
		
		
	}
	
	
	static void Arrays(){
		
		Integer a[] = { 1, 100, 40,0, 00};
		
		java.util.Arrays.sort(a);
				
		List l = Arrays.asList(a);
		
		for (Object k : l){
			
			System.out.println(k);
			
		}
		
		
		System.out.println(Arrays.binarySearch(a, 100));
		
		
	}
	
	
	static void vector(){
		
		
		Vector vector = new Vector();
		
		vector.add(1);
		vector.add(2);
		vector.add(3);
		
		
		for (Object o: vector){
			
			System.out.println(o);
		}
				
	}
	
	
	static void linkList(){
		
		List <Integer>list = new LinkedList<Integer>();
		
		list.add(1);
		list.add(4);
		list.add(10);
		list.add(4);
		
		for (Iterator i = list.iterator() ; i.hasNext();)
			System.out.println(i.next());
		
	}
	
	

}